﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;

public partial class YHGL_XGMM : System.Web.UI.Page
{
  protected void Page_Load(object sender, EventArgs e)
  {

  }
  protected void btnConfirm_Click(object sender, EventArgs e)
  {
    bool flag = false;
    SqlDataReader dr = YHGL.GetXX(SysManage.Get_User);
    if (dr.Read())
    {
      if (DESEncrypt.Encrypt(txtPWD1.Text) != dr["mm"].ToString())
      {
        flag = false;
      }
      else
      {
        flag = true;
      }
    }
    dr.Close();

    if (!flag)
    {
      lbMessage.Text = "密码不正确";
      return;
    }
    string sSql = "update sys_user set mm=@1 where dlm=@0";
    SqlParameter[] cmdParams = new SqlParameter[2] { new SqlParameter("@0", SqlDbType.VarChar, 10), new SqlParameter("@1", SqlDbType.VarChar, 50) };
    cmdParams[0].Value = SysManage.Get_User;
    cmdParams[1].Value = DESEncrypt.Encrypt(txtPWD2.Text);
    if (DbHelperSQL.ExecuteSql(sSql, cmdParams) > 0)
    {
      lbMessage.Text = "修改成功";
    }
  }
}
